package com.vint.mi;

/**
 * 1. done
 * 2. easy
 * 归一数
 */
public class Mi43 {
    public static String solution(String line){
        long l = Long.parseLong(line);
        if(canOne(l)){
            return "true";
        }else{
            return "false";
        }
    }

    public static boolean canOne(long l){
        if(l==1)return true;
        if(l<10)return false;
        int ret = 0;
        while (l>=10){
            ret += (l % 10)*(l % 10);
            l = l / 10;
        }
        return canOne(ret + l * l);
    }
    public static void main(String[] args) {
        System.out.println(canOne(1));
        System.out.println(canOne(82));
        System.out.println(canOne(50));

    }
}
